'''
Function:
    Build the backbone network
Author:
    Zhenchao Jin
'''
import copy
from .beit import BuildBEiT
from .resnet import BuildResNet
from .resnest import BuildResNeSt
from .convnext import BuildConvNeXt
from .mae import BuildMAE


'''BuildBackbone'''
def BuildBackbone(backbone_cfg):
    supported_backbones = {
        'beit': BuildBEiT,
        'resnet': BuildResNet,
        'resnest': BuildResNeSt,
        'convnext': BuildConvNeXt,
        'mae': BuildMAE, 
    }
    selected_backbone = supported_backbones[backbone_cfg['series']]
    backbone_cfg = copy.deepcopy(backbone_cfg)
    backbone_cfg.pop('series')
    return selected_backbone(backbone_cfg)